package com.zeus.common.constants;

/**
 * 配置常量
 *
 * @author f1ybear_wang  2022/2/7 6:02 下午
 */
public class ZeusConfigConstant {
    /**
     * apollo配置命名空间
     */
    public static final String APOLLO_CONFIG_NAMESPACE = "zeus-config.yaml";

    public static final String GROUP_ID = "DEFAULT_GROUP";
    public static final String DATA_ID = "zeus-config.yml";

    /**
     * 配置中key
     */
    public static class Key {

        /**
         * 基础配置
         */
        public static class Base {
            /**
             * 报警是否开启 key
             */
            public static final String MONITOR_ENABLED = "alarm.enabled";

            /**
             * 模式 key
             */
            public static final String MONITOR_MODEL = "alarm.model";

            /**
             * 报警钉钉机器人 key
             */
            public static final String MONITOR_DING_TALK = "alarm.ding.talk";

            /**
             * 报警黑名单, api不进行拦截 key
             */
            public static final String LOG_MONITOR_BACK_LIST = "alarm.back.list";

            /**
             * 报警错误信息字符串长度 key
             */
            public static final String MONITOR_MESSAGE_LENGTH = "alarm.message.length";

            /**
             * 报警异常信息字符串长度 key
             */
            public static final String MONITOR_EXCEPTION_LENGTH = "alarm.exception.length";

            /**
             * 报警堆栈字符串长度 key
             */
            public static final String MONITOR_STACK_LENGTH = "alarm.stack.length";

            /**
             * ELK中项目索引名称 key
             */
            public static final String MONITOR_ELK_URL = "alarm.elk.url";

            /**
             * 宙斯日志是否打印 key
             */
            public static final String MONITOR_LOG_PRINT_ENABLED = "alarm.log.print.enabled";

            /**
             * 宙斯服务启动通知是否开启 key
             */
            public static final String START_NOTIFY_ENABLED = "alarm.start.notify.enabled";

            /**
             * 宙斯服务关闭通知是否开启 key
             */
            public static final String SHUTDOWN_NOTIFY_ENABLED = "alarm.shutdown.notify.enabled";

            /**
             * 应用名称 key
             */
            public static final String APPLICATION_NAME = "spring.application.name";

            /**
             * 环境 key
             */
            public static final String SPRING_PROFILES_ACTIVE = "spring.profiles.active";
            public static final String SPRING_PROFILES_ACTIVE_2 = "SW_AGENT_CLUSTER";
        }

        /**
         * 报警级别规则 key
         */
        public static final String MONITOR_ALARM_LEVEL_RULE = "alarm.level.rule";

        /**
         * 超级配置
         */
        public static class Super {
            /**
             * 报警是否开启 key
             */
            public static final String SUPER_MONITOR_ENABLED = "super.alarm.enabled";

            /**
             * 模式 key
             */
            public static final String SUPER_MONITOR_MODEL = "super.alarm.model";

            /**
             * 报警黑名单, api不进行拦截 key
             */
            public static final String SUPER_LOG_MONITOR_BACK_LIST = "super.alarm.back.list";
        }

        /**
         * 聚合规则2-阈值
         */
        public static final String RULE2_THRESHOLD = "alarm.rule2.threshold";
    }

    /**
     * 配置中一些默认值
     */
    public static class DefaultValue {
        /**
         * 默认错误信息字符串长度
         */
        public static final int DEFAULT_MESSAGE_LENGTH = 300;

        /**
         * 默认异常信息字符串长度
         */
        public static final int DEFAULT_EXCEPTION_LENGTH = 300;

        /**
         * 默认堆栈字符串长度
         */
        public static final int DEFAULT_STACK_LENGTH = 300;

        /**
         * 钉钉消息默认标题
         */
        public static final String DING_TALK_MESSAGE_DEFAULT_TITLE = "报警";

        /**
         * 默认速率
         */
        public static final double DEFAULT_RATE = 0.1d;

        /**
         * 聚合规则2-阈值默认值6
         */
        public static final int DEFAULT_RULE2_THRESHOLD_NUMBER = 6;

        /**
         * 聚合规则2-时间默认值1分钟
         */
        public static final int DEFAULT_RULE2_THRESHOLD_TIME = 1;
    }

}
